package com.mapper;

import com.pojo.CClass;
import com.pojo.SSthdent;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author admin
* @description 针对表【c_class】的数据库操作Mapper
* @createDate 2024-11-19 21:54:55
* @Entity com.pojo.CClass
*/
public interface CClassMapper {

    int deleteByPrimaryKey(Long id);

    int insert(CClass record);

    int insertSelective(CClass record);

    CClass selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(CClass record);

    int updateByPrimaryKey(CClass record);
    @Select("select * from c_class where id=#{id}")

    @Results({
            @Result(id =true,column ="id",property = "id"),
            @Result(column ="className",property = "classname", many = @Many(select="com.mapper.SStudentMapper.selectSSthdentbyId"))})
    CClass selectCClassById(int id);

//    一对一查询
    @Select("select classname from c_class where id=#{id}")
    CClass selectCclassId(int id);


//    一对多
    @Select("select * from c_class where id=#{id}")
    @Results({
            @Result(id =true,column ="id",property = "id"),
            @Result(column ="className",property = "classname")
    })
    CClass selectCClassByIdlist(int id);
}
